package com.qf.flash.mvp.presenter;

import com.qf.flash.http.HttpManager;
import com.qf.flash.model.LifeDetailsBean;
import com.qf.flash.mvp.contract.LifeDetailsContract;
import com.qf.flashlib.base.BasePresenter;
import com.qf.flashlib.base.BaseSubscriber;
import com.qf.flashlib.util.RxUtils;

public class LifeDetailsPresenter extends BasePresenter<LifeDetailsContract.View> implements LifeDetailsContract.Presenter {
    @Override
    public void getLifeDetails(String id) {
        addSubscription(HttpManager.getInstance().getGsonHttpApi()
                .GET_LIFE_DETAILS(id)
                .compose(RxUtils.handleResult())
                .compose(RxUtils.io_main())
                .subscribeWith(new BaseSubscriber<LifeDetailsBean>(mRootView) {
                                   @Override
                                   public void onSuccess(LifeDetailsBean lifeDetailsBean) {
                                       mRootView.showDatas(lifeDetailsBean);
                                   }
                               }
                )
        );
    }
}
